﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Private/Privada.master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="HRP.Private.Cargos.Index" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PrivadaMainContent" runat="server">
    <div class="box-info full">
        <h2><strong>Cargos</strong></h2>
        <div class="data-table-toolbar">
            <div class="row">
                <div class="col-md-4">
                    <label>Departamento</label>
                    <asp:DropDownList AutoPostBack="true"
                        ID="departamentosList" CssClass="form-control selectpicker" runat="server" DataTextField="departamento" DataValueField="id">
                    </asp:DropDownList>
                </div>
                <div class="col-md-8">
                    <div class="toolbar-btn-action">
                        <a class="btn btn-success md-trigger" href="Criar.aspx">Criar Novo Cargo <i class="fa fa-plus-circle"></i></a>
                        <a class="btn btn-danger">Apagar <i class="fa fa-trash-o"></i></a>
                        <%--                        <a class="btn btn-primary"><i class="fa fa-refresh"></i>Update</a>--%>
                    </div>
                </div>
            </div>
            <%if (cargosTable.Items.Count == 0)
              { %>
            <h5>Não tem cargos registados.
            </h5>
            <%} %>
        </div>
        

        <%if (cargosTable.Items.Count > 0)
          { %>
        <asp:Repeater runat="server" ID="cargosTable">
            <HeaderTemplate>
                <div class="table-responsive">
                    <table data-sortable class="table table-hover table-striped">
                        <thead>
                            <tr>
                                <th style="width: 30px" data-sortable="false">
                                    <input type="checkbox" class="rows-check"></th>
                                <th>Nome</th>
                                <th>Departamento</th>
                                <th>Observação</th>
                                <th>Data de Criação</th>
                                <th>Activo</th>
                                <th data-sortable="false">Opção</th>
                            </tr>
                        </thead>
                        <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <input type="checkbox" class="rows-check"></td>
                    <td><%#Eval("Nome") %></td>
                    <td><a href="../Departamentos/Editar.aspx?id=<%#Eval("DepartamentoId") %>"><%#Eval("Departamento") %></a></td>
                    <td><%#Eval("Observacao") %></td>
                    <td><%#((DateTime)Eval("DataCriacao")).ToString(HRP.Utilidades.DefinicoesSite.DataFormato) %></td>
                    <td><span class="label <%#(bool)Eval("Activo") ? "label-success" : "label-danger"%> "><%#(bool)Eval("Activo") ? "Sim" : "Não"%></span></td>
                    <td>
                        <div class="btn-group btn-group-xs">
                            <asp:LinkButton ID="activarDesButton" data-toggle="tooltip" ToolTip='<%#(bool)Eval("activo") ? "Desactivar" : "Activar"%>' CssClass="btn btn-default" runat="server" CommandArgument='<%#Eval("id") %>' OnCommand="alterarEstadoCargo"><i class="fa fa-power-off"></i></asp:LinkButton>
                            <a href='Editar.aspx?id=<%#Eval("id") %>' data-toggle="tooltip" title="Editar" class="btn btn-default"><i class="fa fa-edit"></i></a>
                        </div>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate></tbody></table></div></FooterTemplate>
        </asp:Repeater>
        <%} %>
    </div>

</asp:Content>
